package dto;

import implementor.BillImplementor;
import implementor.MaterialImp;

import java.sql.Date;


public class Sell {
	private int autoitemCode;
	private String mCode;
	private int billId;
	private double sellMrp;
	private String taxCode;
	private double discount;
	private double sellQuant;
	
	//model attributes
	private Bill modelBiil;
	private Material modelMaterial;
	
	public Sell() {
	
	}

	// DTO CONSTRUCTOR
	public Sell(int autoitemCode, String mCode, int billId, double sellMrp,
			String taxCode, double discount, double sellQuant) {
		super();
		this.autoitemCode = autoitemCode;
		this.mCode = mCode;
		this.billId = billId;
		this.sellMrp = sellMrp;
		this.taxCode = taxCode;
		this.discount = discount;
		this.sellQuant = sellQuant;
	}
	
	// MODEL CONSTRUCTOR
	

	

	public Sell(int autoitemCode, String mCode, int billId, double sellMrp,
			String taxCode, double discount, double sellQuant, Bill modelBiil,
			Material modelMaterial) {
		super();
		this.autoitemCode = autoitemCode;
		this.mCode = mCode;
		this.billId = billId;
		this.sellMrp = sellMrp;
		this.taxCode = taxCode;
		this.discount = discount;
		this.sellQuant = sellQuant;
		this.modelBiil = modelBiil;
		this.modelMaterial = modelMaterial;
	}
	
	public void setMaterial()
	{
		MaterialImp mimp = new MaterialImp();
		try {
			this.modelMaterial=mimp.retrieve("mCode",mCode);
			System.out.println("SET MATERIAL ID = "+modelMaterial.getmCode()+" "+modelMaterial.getCatId() +" ");
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
	
	public void setBill()
	{
		BillImplementor mimp = new BillImplementor();
		try {
			this.modelBiil=mimp.retrieve("autoBillId",billId+"");
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
	
	
	
	public int getAutoitemCode() {
		return autoitemCode;
	}
	public void setAutoitemCode(int autoitemCode) {
		this.autoitemCode = autoitemCode;
	}

	public String getmCode() {
		return mCode;
	}

	public void setmCode(String mCode) {
		this.mCode = mCode;
	}

	public int getBillId() {
		return billId;
	}

	public void setBillId(int billId) {
		this.billId = billId;
	}

	public double getSellMrp() {
		return sellMrp;
	}

	public void setSellMrp(double sellMrp) {
		this.sellMrp = sellMrp;
	}

	public String getTaxCode() {
		return taxCode;
	}

	public void setTaxCode(String taxCode) {
		this.taxCode = taxCode;
	}

	public double getDiscount() {
		return discount;
	}

	public void setDiscount(double discount) {
		this.discount = discount;
	}

	public double getSellQuant() {
		return sellQuant;
	}

	public void setSellQuant(double sellQuant) {
		this.sellQuant = sellQuant;
	}

	public Bill getModelBiil() {
		return modelBiil;
	}

	public void setModelBiil(Bill modelBiil) {
		this.modelBiil = modelBiil;
	}

	public Material getModelMaterial() {
		return modelMaterial;
	}

	public void setModelMaterial(Material modelMaterial) {
		this.modelMaterial = modelMaterial;
	}
}
